package com.ll.dal.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ll.domain.classbase.enums.CourseIsNotifyEnum;
import com.ll.domain.classbase.enums.CourseStatusEnum;
import com.ll.domain.classbase.enums.CourseTypeEnum;
import lombok.Data;

import java.util.Date;

@Data
@TableName("course")
public class CoursePO {
    @TableId(type= IdType.AUTO)
    private Long id;
    private String title;
    private String teacher;
    private Date startTime;
    private Date endTime;
    private CourseStatusEnum status;
    private CourseTypeEnum type;
    private Integer applicants;
    private Integer maxPeople;
    private String extData;
    private String dingTalkUserId;
    private CourseIsNotifyEnum isNotify;

//    @JSONField(name = "status")
//    public Integer getState() {
//        return Optional.ofNullable(status)
//                .map(r->r.ordinal()).orElse(null);
//    }
//
//    @JSONField(name = "status")
//    public void setState(String code) {
////        this.myEnum = MyEnum.getEnumByCode(code);
//    }

    public boolean checkCanApply(){
        return this.applicants < this.maxPeople;
    }
}
